package cn.edu.zju.om.analyse;

public class Modifier {
	
	private String modifierString;
	
	private int count;
	
	private double ratingSum;
	
	public Modifier(String modifierString, float rating) {
		this.count = 1;
		this.modifierString = modifierString;
		this.ratingSum = rating;
	}
	
	public String getModifierName() {
		return modifierString;
	}
	
	public int getCount() {
		return count;
	}
	
	public float getAverageRating() {
		return (float) ratingSum / count;
	}
	
	public void update(float rating) {
		ratingSum += rating;
		++count;
	}
	
	@Override
	public String toString() {
		return String.format("%s\t%d\t%f", this.modifierString, getCount(), getAverageRating());
	}

}
